﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NGourd.Core.Steps;
using NGourd.Core.Assertions;

namespace BasicSample.Features.Steps
{
    [Steps]
    class OrderSteps : StepContainerBase
    {
        Order order = new Order();

        [Step("there is a new order")]
        public void CreateNewOrder()
        {
            order = new Order();
        }

        [Step(@"add (\d+) (\w+) worth \$(\d+) each")]
        public void AddItem(string qty, string product, string worth)
        {
            int actualQty = Int32.Parse(qty);
            double actualWorth = Double.Parse(worth);

            order.AddLineItem(actualQty, product, actualWorth);
        }

        [Step(@"order should be worth \$(\d+.\d+)")]
        public void CheckValue(string val)
        {
            var expecedOrderValue = Double.Parse(val);

            Assert.AreEqual(expecedOrderValue, order.TotalValue);
        }
    }
}
